package config

import (
	"fmt"
	"strings"
	"time"
)

func Unsplash() *UnsplashConfig {
	return &UnsplashConfig{
		ClientId:            "8X2SUylXXxZERuItUN9cRRc2r2_RGcTukGet99dHMuM",
		Orientation:         "landscape",
		ContentFilter:       "low",
		Topics:              []string{"fashion", "arts-culture", "business-work"},
		Count:               "30",
		RandomPhotoDuration: time.Minute * 2,
	}
}

type UnsplashConfig struct {
	ClientId            string        `json:"client_id"`
	Orientation         string        `json:"orientation"`
	ContentFilter       string        `json:"content_filter"`
	Topics              []string      `json:"topics"`
	Count               string        `json:"count"`
	RandomPhotoDuration time.Duration `json:"random_photo_duration"`
}

func (c UnsplashConfig) ToString() string {
	return fmt.Sprintf("client_id=%s&orientation=%s&content_filter=%s&topics=%s&count=%s",
		c.ClientId,
		c.Orientation,
		c.ContentFilter,
		strings.Join(c.Topics, ","),
		c.Count,
	)
}
